/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */
package view;

import java.awt.Color;
import java.text.SimpleDateFormat;
import java.util.Calendar;
import java.util.Locale;
import java.util.Date;
import javax.swing.BorderFactory;
import javax.swing.JOptionPane;
import main.BarApplication;
import model.Validator;
import model.Member;
import connectivity.QueryManager;
import java.sql.ResultSet;

/**
 *
 * @author Home
 */
public class AddSubscribeMember extends javax.swing.JPanel {

    public boolean nieuwLid = true;
    private int memberId;
    private String firstName;
    private String middleName;
    private String lastName;
    private String gender;
    private String birthday;
    private String address;
    private String zip_code;
    private String residence;
    private String telephoneNumber;
    private String mobilePhone;
    private String emailAddress;
    private String bankAccount;
    private String password;
    private int vestigingID;
    private int abonnement;
    private boolean status;
    Member member = new Member();

    /**
     * Creates new form AddSubscribeMember
     */
    public AddSubscribeMember() {
        initComponents();
        //jTextField_MemberId.setVisible(false);
        
        Calendar calendar = Calendar.getInstance();
        SimpleDateFormat dateFormatJaar = new SimpleDateFormat("yyyy");
        int jaar;
        //Huidige dag opvragen today
        jaar = Integer.parseInt(dateFormatJaar.format(calendar.getTime()));
        jComboBox_Jaar.removeAllItems();
        for (int i = jaar; i > 1920; i--) {
            jComboBox_Jaar.addItem(Integer.toString(i));
        }
        jComboBox_Maand.removeAllItems();
        for (int i = 1; i < 13; i++) {
            jComboBox_Maand.addItem(Integer.toString(i));
        }
        jComboBox_Dag.removeAllItems();
        for (int i = 1; i < 32; i++) {
            jComboBox_Dag.addItem(Integer.toString(i));
        }
    }

    /**
     * This method is called from within the constructor to initialize the form.
     * WARNING: Do NOT modify this code. The content of this method is always
     * regenerated by the Form Editor.
     */
    @SuppressWarnings("unchecked")
    // <editor-fold defaultstate="collapsed" desc="Generated Code">//GEN-BEGIN:initComponents
    private void initComponents() {

        jToggleButton1 = new javax.swing.JToggleButton();
        buttonGroup1 = new javax.swing.ButtonGroup();
        buttonGroup2 = new javax.swing.ButtonGroup();
        buttonGroup3 = new javax.swing.ButtonGroup();
        jPanel5 = new javax.swing.JPanel();
        jPanel3 = new javax.swing.JPanel();
        jLabel18 = new javax.swing.JLabel();
        jLabel19 = new javax.swing.JLabel();
        jLabel20 = new javax.swing.JLabel();
        jCheckBox9_Loc2 = new javax.swing.JCheckBox();
        jCheckBox_Loc3 = new javax.swing.JCheckBox();
        jCheckBox_Loc1 = new javax.swing.JCheckBox();
        jPanel4 = new javax.swing.JPanel();
        jLabel26 = new javax.swing.JLabel();
        jTextField_Rekeningnummer = new javax.swing.JTextField();
        jPanel1 = new javax.swing.JPanel();
        jLabel14 = new javax.swing.JLabel();
        jLabel12 = new javax.swing.JLabel();
        jCheckBox3_AboWkDg = new javax.swing.JCheckBox();
        jCheckBox5_AboVol = new javax.swing.JCheckBox();
        jCheckBoxMinderjarig = new javax.swing.JCheckBox();
        jLabel17 = new javax.swing.JLabel();
        jCheckBoxVolwassen = new javax.swing.JCheckBox();
        jCheckBoxSenioren = new javax.swing.JCheckBox();
        jLabel15 = new javax.swing.JLabel();
        jLabel16 = new javax.swing.JLabel();
        jTextField_Bedrag = new javax.swing.JTextField();
        jLabel23 = new javax.swing.JLabel();
        jButton_Save = new javax.swing.JButton();
        Personalia_JPanel = new javax.swing.JPanel();
        jLabel3 = new javax.swing.JLabel();
        jTextField_Email = new javax.swing.JTextField();
        jLabel2 = new javax.swing.JLabel();
        jTextField_StraatHnr = new javax.swing.JTextField();
        jCheckBox_Vrouw = new javax.swing.JCheckBox();
        jLabel9 = new javax.swing.JLabel();
        jTextField_Tussenvoegsel = new javax.swing.JTextField();
        jLabel7 = new javax.swing.JLabel();
        jLabel5 = new javax.swing.JLabel();
        jLabel10 = new javax.swing.JLabel();
        jCheckBox_Man = new javax.swing.JCheckBox();
        jLabel1 = new javax.swing.JLabel();
        jLabel11 = new javax.swing.JLabel();
        jLabel6 = new javax.swing.JLabel();
        jTextField_Achternaam = new javax.swing.JTextField();
        jTextField_MobielNr = new javax.swing.JTextField();
        jLabel8 = new javax.swing.JLabel();
        jTextField_woonplaats = new javax.swing.JTextField();
        jTextField_Postcode = new javax.swing.JTextField();
        jTextField_Telnr = new javax.swing.JTextField();
        jLabel4 = new javax.swing.JLabel();
        jTextField_voornaam = new javax.swing.JTextField();
        jComboBox_Dag = new javax.swing.JComboBox();
        jComboBox_Maand = new javax.swing.JComboBox();
        jComboBox_Jaar = new javax.swing.JComboBox();
        jTextField_MemberId = new javax.swing.JTextField();
        jLabel13 = new javax.swing.JLabel();
        jLabel21 = new javax.swing.JLabel();
        jPasswordField1 = new javax.swing.JPasswordField();
        jPanel6 = new javax.swing.JPanel();
        jCheckBoxStatusActief = new javax.swing.JCheckBox();
        jCheckBoxStatusNietActief = new javax.swing.JCheckBox();

        jToggleButton1.setText("jToggleButton1");

        jPanel3.setBackground(new java.awt.Color(204, 255, 204));
        jPanel3.setBorder(javax.swing.BorderFactory.createTitledBorder(null, "Primaire Locatie", javax.swing.border.TitledBorder.DEFAULT_JUSTIFICATION, javax.swing.border.TitledBorder.DEFAULT_POSITION, new java.awt.Font("Arial", 1, 12), new java.awt.Color(0, 102, 153))); // NOI18N

        jLabel18.setText("Purmerend");

        jLabel19.setText("Alkmaar");

        jLabel20.setText("Haarlem");

        jCheckBox9_Loc2.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                jCheckBox9_Loc2ActionPerformed(evt);
            }
        });

        jCheckBox_Loc3.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                jCheckBox_Loc3ActionPerformed(evt);
            }
        });

        jCheckBox_Loc1.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                jCheckBox_Loc1ActionPerformed(evt);
            }
        });

        javax.swing.GroupLayout jPanel3Layout = new javax.swing.GroupLayout(jPanel3);
        jPanel3.setLayout(jPanel3Layout);
        jPanel3Layout.setHorizontalGroup(
            jPanel3Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(jPanel3Layout.createSequentialGroup()
                .addContainerGap()
                .addGroup(jPanel3Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                    .addGroup(jPanel3Layout.createSequentialGroup()
                        .addGap(9, 9, 9)
                        .addComponent(jCheckBox9_Loc2))
                    .addComponent(jLabel20))
                .addGap(31, 31, 31)
                .addGroup(jPanel3Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                    .addGroup(jPanel3Layout.createSequentialGroup()
                        .addGap(10, 10, 10)
                        .addComponent(jCheckBox_Loc3)
                        .addGap(59, 59, 59)
                        .addComponent(jCheckBox_Loc1))
                    .addGroup(jPanel3Layout.createSequentialGroup()
                        .addComponent(jLabel18)
                        .addGap(29, 29, 29)
                        .addComponent(jLabel19)))
                .addContainerGap(70, Short.MAX_VALUE))
        );
        jPanel3Layout.setVerticalGroup(
            jPanel3Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(jPanel3Layout.createSequentialGroup()
                .addContainerGap()
                .addGroup(jPanel3Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
                    .addComponent(jLabel20)
                    .addComponent(jLabel18)
                    .addComponent(jLabel19))
                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                .addGroup(jPanel3Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                    .addComponent(jCheckBox_Loc3)
                    .addComponent(jCheckBox_Loc1)
                    .addComponent(jCheckBox9_Loc2))
                .addContainerGap())
        );

        jPanel4.setBackground(new java.awt.Color(204, 255, 204));
        jPanel4.setBorder(javax.swing.BorderFactory.createTitledBorder(null, "Totaal bedrag", javax.swing.border.TitledBorder.DEFAULT_JUSTIFICATION, javax.swing.border.TitledBorder.DEFAULT_POSITION, new java.awt.Font("Arial", 1, 12), new java.awt.Color(0, 102, 153))); // NOI18N

        jLabel26.setText("Rekeningnummer");

        javax.swing.GroupLayout jPanel4Layout = new javax.swing.GroupLayout(jPanel4);
        jPanel4.setLayout(jPanel4Layout);
        jPanel4Layout.setHorizontalGroup(
            jPanel4Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(jPanel4Layout.createSequentialGroup()
                .addContainerGap()
                .addGroup(jPanel4Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                    .addComponent(jLabel26)
                    .addComponent(jTextField_Rekeningnummer, javax.swing.GroupLayout.PREFERRED_SIZE, 205, javax.swing.GroupLayout.PREFERRED_SIZE))
                .addContainerGap(83, Short.MAX_VALUE))
        );
        jPanel4Layout.setVerticalGroup(
            jPanel4Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(jPanel4Layout.createSequentialGroup()
                .addContainerGap()
                .addComponent(jLabel26)
                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                .addComponent(jTextField_Rekeningnummer, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
                .addContainerGap(26, Short.MAX_VALUE))
        );

        jPanel1.setBackground(new java.awt.Color(204, 255, 204));
        jPanel1.setBorder(javax.swing.BorderFactory.createTitledBorder(null, "Abonnement", javax.swing.border.TitledBorder.DEFAULT_JUSTIFICATION, javax.swing.border.TitledBorder.DEFAULT_POSITION, new java.awt.Font("Arial", 1, 12), new java.awt.Color(0, 102, 153))); // NOI18N

        jLabel14.setText("Volledig Abonnement");

        jLabel12.setText("Daluren Abonnement");

        jCheckBox3_AboWkDg.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                jCheckBox3_AboWkDgActionPerformed(evt);
            }
        });

        jCheckBox5_AboVol.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                jCheckBox5_AboVolActionPerformed(evt);
            }
        });

        jCheckBoxMinderjarig.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                jCheckBoxMinderjarigActionPerformed(evt);
            }
        });

        jLabel17.setText("Minderjarig");

        jCheckBoxVolwassen.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                jCheckBoxVolwassenActionPerformed(evt);
            }
        });

        jCheckBoxSenioren.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                jCheckBoxSeniorenActionPerformed(evt);
            }
        });

        jLabel15.setText("Volwassen");

        jLabel16.setText("Senioren");

        jTextField_Bedrag.setEditable(false);

        jLabel23.setText("Prijs Abonnement:");

        javax.swing.GroupLayout jPanel1Layout = new javax.swing.GroupLayout(jPanel1);
        jPanel1.setLayout(jPanel1Layout);
        jPanel1Layout.setHorizontalGroup(
            jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(jPanel1Layout.createSequentialGroup()
                .addContainerGap()
                .addGroup(jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                    .addGroup(javax.swing.GroupLayout.Alignment.TRAILING, jPanel1Layout.createSequentialGroup()
                        .addGroup(jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.TRAILING)
                            .addGroup(jPanel1Layout.createSequentialGroup()
                                .addGroup(jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                                    .addComponent(jLabel12)
                                    .addGroup(jPanel1Layout.createSequentialGroup()
                                        .addGap(47, 47, 47)
                                        .addComponent(jCheckBox3_AboWkDg)))
                                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
                                .addGroup(jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                                    .addComponent(jLabel14)
                                    .addGroup(jPanel1Layout.createSequentialGroup()
                                        .addGap(10, 10, 10)
                                        .addComponent(jCheckBox5_AboVol))))
                            .addGroup(jPanel1Layout.createSequentialGroup()
                                .addComponent(jTextField_Bedrag)
                                .addGap(10, 10, 10))
                            .addGroup(javax.swing.GroupLayout.Alignment.LEADING, jPanel1Layout.createSequentialGroup()
                                .addGap(14, 14, 14)
                                .addGroup(jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                                    .addGroup(jPanel1Layout.createSequentialGroup()
                                        .addComponent(jLabel17)
                                        .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED)
                                        .addComponent(jLabel15)
                                        .addGap(18, 18, 18)
                                        .addComponent(jLabel16))
                                    .addGroup(jPanel1Layout.createSequentialGroup()
                                        .addGap(26, 26, 26)
                                        .addComponent(jCheckBoxMinderjarig)
                                        .addGap(51, 51, 51)
                                        .addComponent(jCheckBoxVolwassen)
                                        .addGap(45, 45, 45)
                                        .addComponent(jCheckBoxSenioren)))
                                .addGap(0, 0, Short.MAX_VALUE)))
                        .addGap(24, 24, 24))
                    .addGroup(jPanel1Layout.createSequentialGroup()
                        .addComponent(jLabel23)
                        .addContainerGap(182, Short.MAX_VALUE))))
        );
        jPanel1Layout.setVerticalGroup(
            jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(jPanel1Layout.createSequentialGroup()
                .addContainerGap()
                .addGroup(jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
                    .addComponent(jLabel12)
                    .addComponent(jLabel14))
                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                .addGroup(jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                    .addComponent(jCheckBox3_AboWkDg, javax.swing.GroupLayout.Alignment.TRAILING)
                    .addComponent(jCheckBox5_AboVol, javax.swing.GroupLayout.Alignment.TRAILING))
                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED, 44, Short.MAX_VALUE)
                .addGroup(jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
                    .addComponent(jLabel17)
                    .addComponent(jLabel15)
                    .addComponent(jLabel16))
                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                .addGroup(jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                    .addComponent(jCheckBoxSenioren, javax.swing.GroupLayout.Alignment.TRAILING)
                    .addComponent(jCheckBoxVolwassen, javax.swing.GroupLayout.Alignment.TRAILING)
                    .addComponent(jCheckBoxMinderjarig))
                .addGap(42, 42, 42)
                .addComponent(jLabel23)
                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED)
                .addComponent(jTextField_Bedrag, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
                .addGap(26, 26, 26))
        );

        jCheckBoxMinderjarig.getAccessibleContext().setAccessibleDescription("");

        jButton_Save.setForeground(new java.awt.Color(102, 102, 102));
        jButton_Save.setIcon(new javax.swing.ImageIcon(getClass().getResource("/images/Save-icon.png"))); // NOI18N
        jButton_Save.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                jButton_SaveActionPerformed(evt);
            }
        });

        Personalia_JPanel.setBackground(new java.awt.Color(204, 255, 204));
        Personalia_JPanel.setBorder(javax.swing.BorderFactory.createTitledBorder(javax.swing.BorderFactory.createTitledBorder(null, "Personalia", javax.swing.border.TitledBorder.DEFAULT_JUSTIFICATION, javax.swing.border.TitledBorder.DEFAULT_POSITION, new java.awt.Font("Arial", 1, 12), new java.awt.Color(0, 102, 153)))); // NOI18N

        jLabel3.setText("Achternaam");

        jLabel2.setText("Tussenvoegsel");

        jCheckBox_Vrouw.setText(" V");

        jLabel9.setText("Telefoonnummer");

        jTextField_Tussenvoegsel.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                jTextField_TussenvoegselActionPerformed(evt);
            }
        });

        jLabel7.setText("Postcode");

        jLabel5.setText("Geslacht");

        jLabel10.setText("Mobiel telefoonnummer");

        jCheckBox_Man.setText(" M");

        jLabel1.setText("Voornaam");

        jLabel11.setText("E-mail adres");

        jLabel6.setText("Straat + Huisnummer");

        jLabel8.setText("Woonplaats");

        jLabel4.setText("Geboortedatum");

        jTextField_voornaam.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                jTextField_voornaamActionPerformed(evt);
            }
        });

        jTextField_MemberId.setEditable(false);

        jLabel13.setText("ID nummer");

        jLabel21.setText("Wachtwoord");

        javax.swing.GroupLayout Personalia_JPanelLayout = new javax.swing.GroupLayout(Personalia_JPanel);
        Personalia_JPanel.setLayout(Personalia_JPanelLayout);
        Personalia_JPanelLayout.setHorizontalGroup(
            Personalia_JPanelLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(Personalia_JPanelLayout.createSequentialGroup()
                .addContainerGap()
                .addGroup(Personalia_JPanelLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                    .addComponent(jTextField_Achternaam)
                    .addComponent(jTextField_StraatHnr)
                    .addComponent(jTextField_Postcode)
                    .addComponent(jTextField_woonplaats)
                    .addComponent(jTextField_Telnr)
                    .addComponent(jTextField_MobielNr)
                    .addGroup(Personalia_JPanelLayout.createSequentialGroup()
                        .addComponent(jComboBox_Dag, javax.swing.GroupLayout.PREFERRED_SIZE, 41, javax.swing.GroupLayout.PREFERRED_SIZE)
                        .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                        .addComponent(jComboBox_Maand, javax.swing.GroupLayout.PREFERRED_SIZE, 45, javax.swing.GroupLayout.PREFERRED_SIZE)
                        .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED, 104, Short.MAX_VALUE)
                        .addComponent(jComboBox_Jaar, javax.swing.GroupLayout.PREFERRED_SIZE, 83, javax.swing.GroupLayout.PREFERRED_SIZE))
                    .addGroup(Personalia_JPanelLayout.createSequentialGroup()
                        .addGroup(Personalia_JPanelLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING, false)
                            .addComponent(jLabel21)
                            .addComponent(jTextField_Email, javax.swing.GroupLayout.DEFAULT_SIZE, 180, Short.MAX_VALUE)
                            .addComponent(jLabel3)
                            .addComponent(jLabel8)
                            .addComponent(jLabel7)
                            .addComponent(jLabel2)
                            .addComponent(jLabel9)
                            .addComponent(jLabel10)
                            .addComponent(jLabel11)
                            .addComponent(jLabel4)
                            .addComponent(jTextField_voornaam)
                            .addComponent(jTextField_Tussenvoegsel)
                            .addGroup(Personalia_JPanelLayout.createSequentialGroup()
                                .addComponent(jCheckBox_Man)
                                .addGap(18, 18, 18)
                                .addComponent(jCheckBox_Vrouw))
                            .addComponent(jLabel6)
                            .addComponent(jLabel5)
                            .addComponent(jLabel1)
                            .addComponent(jLabel13)
                            .addComponent(jTextField_MemberId)
                            .addComponent(jPasswordField1))
                        .addGap(0, 0, Short.MAX_VALUE)))
                .addContainerGap())
        );
        Personalia_JPanelLayout.setVerticalGroup(
            Personalia_JPanelLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(Personalia_JPanelLayout.createSequentialGroup()
                .addContainerGap(javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
                .addComponent(jLabel13)
                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                .addComponent(jTextField_MemberId, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                .addComponent(jLabel1)
                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                .addComponent(jTextField_voornaam, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                .addComponent(jLabel2)
                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                .addComponent(jTextField_Tussenvoegsel, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                .addComponent(jLabel3, javax.swing.GroupLayout.PREFERRED_SIZE, 12, javax.swing.GroupLayout.PREFERRED_SIZE)
                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                .addComponent(jTextField_Achternaam, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                .addComponent(jLabel4)
                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                .addGroup(Personalia_JPanelLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
                    .addComponent(jComboBox_Dag, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
                    .addComponent(jComboBox_Maand, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
                    .addComponent(jComboBox_Jaar, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE))
                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                .addComponent(jLabel5)
                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                .addGroup(Personalia_JPanelLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
                    .addComponent(jCheckBox_Man)
                    .addComponent(jCheckBox_Vrouw))
                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                .addComponent(jLabel6)
                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                .addComponent(jTextField_StraatHnr, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                .addComponent(jLabel7)
                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                .addComponent(jTextField_Postcode, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                .addComponent(jLabel8)
                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                .addComponent(jTextField_woonplaats, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                .addComponent(jLabel9)
                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                .addComponent(jTextField_Telnr, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                .addComponent(jLabel10)
                .addGap(4, 4, 4)
                .addComponent(jTextField_MobielNr, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                .addComponent(jLabel11)
                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                .addComponent(jTextField_Email, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                .addComponent(jLabel21)
                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                .addComponent(jPasswordField1, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE))
        );

        jPanel6.setBackground(new java.awt.Color(204, 255, 204));
        jPanel6.setBorder(javax.swing.BorderFactory.createTitledBorder(null, "Status lid", javax.swing.border.TitledBorder.DEFAULT_JUSTIFICATION, javax.swing.border.TitledBorder.DEFAULT_POSITION, new java.awt.Font("Arial", 1, 12), new java.awt.Color(0, 102, 153))); // NOI18N

        jCheckBoxStatusActief.setText("Actief");
        jCheckBoxStatusActief.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                jCheckBoxStatusActiefActionPerformed(evt);
            }
        });

        jCheckBoxStatusNietActief.setText("Niet Actief");
        jCheckBoxStatusNietActief.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                jCheckBoxStatusNietActiefActionPerformed(evt);
            }
        });

        javax.swing.GroupLayout jPanel6Layout = new javax.swing.GroupLayout(jPanel6);
        jPanel6.setLayout(jPanel6Layout);
        jPanel6Layout.setHorizontalGroup(
            jPanel6Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(jPanel6Layout.createSequentialGroup()
                .addGap(22, 22, 22)
                .addComponent(jCheckBoxStatusActief)
                .addGap(18, 18, 18)
                .addComponent(jCheckBoxStatusNietActief)
                .addContainerGap(112, Short.MAX_VALUE))
        );
        jPanel6Layout.setVerticalGroup(
            jPanel6Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(javax.swing.GroupLayout.Alignment.TRAILING, jPanel6Layout.createSequentialGroup()
                .addContainerGap(32, Short.MAX_VALUE)
                .addGroup(jPanel6Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
                    .addComponent(jCheckBoxStatusActief)
                    .addComponent(jCheckBoxStatusNietActief))
                .addContainerGap())
        );

        javax.swing.GroupLayout jPanel5Layout = new javax.swing.GroupLayout(jPanel5);
        jPanel5.setLayout(jPanel5Layout);
        jPanel5Layout.setHorizontalGroup(
            jPanel5Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(jPanel5Layout.createSequentialGroup()
                .addContainerGap()
                .addComponent(Personalia_JPanel, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
                .addGap(18, 18, 18)
                .addGroup(jPanel5Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                    .addGroup(jPanel5Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING, false)
                        .addComponent(jPanel1, javax.swing.GroupLayout.Alignment.TRAILING, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
                        .addComponent(jButton_Save, javax.swing.GroupLayout.PREFERRED_SIZE, 228, javax.swing.GroupLayout.PREFERRED_SIZE)
                        .addComponent(jPanel3, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
                        .addComponent(jPanel4, javax.swing.GroupLayout.Alignment.TRAILING, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE))
                    .addComponent(jPanel6, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE))
                .addContainerGap())
        );
        jPanel5Layout.setVerticalGroup(
            jPanel5Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(jPanel5Layout.createSequentialGroup()
                .addGap(0, 0, 0)
                .addGroup(jPanel5Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING, false)
                    .addComponent(Personalia_JPanel, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
                    .addGroup(jPanel5Layout.createSequentialGroup()
                        .addComponent(jPanel1, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
                        .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                        .addComponent(jPanel3, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
                        .addGap(18, 18, 18)
                        .addComponent(jPanel4, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
                        .addGap(6, 6, 6)
                        .addComponent(jPanel6, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
                        .addGap(18, 18, 18)
                        .addComponent(jButton_Save)))
                .addContainerGap(javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE))
        );

        javax.swing.GroupLayout layout = new javax.swing.GroupLayout(this);
        this.setLayout(layout);
        layout.setHorizontalGroup(
            layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addComponent(jPanel5, javax.swing.GroupLayout.Alignment.TRAILING, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
        );
        layout.setVerticalGroup(
            layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(layout.createSequentialGroup()
                .addContainerGap()
                .addComponent(jPanel5, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
                .addContainerGap(98, Short.MAX_VALUE))
        );
    }// </editor-fold>//GEN-END:initComponents

    private void jButton_SaveActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jButton_SaveActionPerformed
        // Set de waardes van de textfields in het Member object

        //memberObj.getId();


        //Uitzonderingsregel op moment dat het een nieuw lid betreft
        if (nieuwLid) {
            memberId = member.getNewMemberID();
        } else {
            memberId = Integer.parseInt(jTextField_MemberId.getText());
        }


        firstName = jTextField_voornaam.getText();
        middleName = jTextField_Tussenvoegsel.getText();
        lastName = jTextField_Achternaam.getText();
        birthday = jComboBox_Jaar.getSelectedItem().toString() + "-" + jComboBox_Maand.getSelectedItem().toString() + "-" + jComboBox_Dag.getSelectedItem().toString();
        address = jTextField_StraatHnr.getText();
        zip_code = jTextField_Postcode.getText();
        residence = jTextField_woonplaats.getText();
        telephoneNumber = jTextField_Telnr.getText();
        mobilePhone = jTextField_MobielNr.getText();
        emailAddress = jTextField_Email.getText();
        bankAccount = jTextField_Rekeningnummer.getText();
        password = new String(jPasswordField1.getPassword());

        // vestigingID en abonnement hier schrijven.

        // Checken welke vestiging is geselecteerd
        vestigingID = 1;
        if (jCheckBox9_Loc2.isSelected()) {
            vestigingID = 2;
        } else if (jCheckBox_Loc3.isSelected()) {
            vestigingID = 3;
        } else if (jCheckBox_Loc1.isSelected()) {
            vestigingID = 1;
        } else {
            JOptionPane.showMessageDialog(this, "Vestiging is niet geselecteerd", "vestigingID", JOptionPane.ERROR_MESSAGE);
        }

        // Checken welke en of abonnement is geselecteerd
        abonnement = 0;
        if (jCheckBox3_AboWkDg.isSelected()) {
            abonnement = 2;
        }
        if (jCheckBox5_AboVol.isSelected()) {
            abonnement = 1;
        }

        //controleren welke geslachts checkbox is geselecteerd
        if (jCheckBox_Man.isSelected()) {
            gender = "man";
        } else if (jCheckBox_Vrouw.isSelected()) {
            gender = "vrouw";
        } else {
            JOptionPane.showMessageDialog(this, "Geslacht is niet geselecteerd", "Geslacht", JOptionPane.ERROR_MESSAGE);
        }
        
        //checken welke status is geselecteerd
        if (jCheckBoxStatusActief.isSelected()){
            status = true;
        }else{
            status = false;
        }




        member.setMemberId(memberId);
        member.setFirstname(firstName);
        member.setMiddlename(middleName);
        member.setLastname(lastName);
        member.setBirthday(birthday);
        member.setGender(gender);
        member.setAddress(address);
        member.setZip_code(zip_code);
        member.setResidence(residence);
        member.setTelephoneNumber(telephoneNumber);
        member.setMobilePhone(mobilePhone);
        member.setEmail(emailAddress);
        member.setBankAccount(bankAccount);
        member.setPassword(password);
        member.setVestigingID(vestigingID);
        member.setAbonnement(abonnement);
        member.setStatus(status);




        //controleren of het email adres goed is genoteerd 
        Validator emailValidator = new model.Validator();
        // boolean valid = emailValidator.validate(emailAddress);

        // Set de waardes van de textfields in het Member object


        //CONTROLEREN OF FIELD IS EMPTY
        if (firstName.equals("")) {

            jTextField_voornaam.setBorder(BorderFactory.createMatteBorder(0, 0, 5, 0, Color.PINK));
            JOptionPane.showMessageDialog(this, "Voer voornaam in", "Voornaam", JOptionPane.ERROR_MESSAGE);

        } else if (lastName.equals("")) {
            jTextField_Achternaam.setBorder(BorderFactory.createMatteBorder(0, 0, 5, 0, Color.PINK));
            JOptionPane.showMessageDialog(this, "Voer achternaam in", "Achternaam", JOptionPane.ERROR_MESSAGE);

        } else if (address.equals("")) {

            jTextField_StraatHnr.setBorder(BorderFactory.createMatteBorder(0, 0, 5, 0, Color.PINK));
            JOptionPane.showMessageDialog(this, "Voer adres in", "Adres", JOptionPane.ERROR_MESSAGE);

        } else if (zip_code.equals("")) {
            jTextField_Postcode.setBorder(BorderFactory.createMatteBorder(0, 0, 5, 0, Color.PINK));
            JOptionPane.showMessageDialog(this, "Voer postcode in", "Postcode", JOptionPane.ERROR_MESSAGE);

        } else if (residence.equals("")) {
            jTextField_woonplaats.setBorder(BorderFactory.createMatteBorder(0, 0, 5, 0, Color.PINK));
            JOptionPane.showMessageDialog(this, "Voer woonplaats in", "Woonplaats", JOptionPane.ERROR_MESSAGE);

        } else if (telephoneNumber.equals("")) {
            jTextField_Telnr.setBorder(BorderFactory.createMatteBorder(0, 0, 5, 0, Color.PINK));
            JOptionPane.showMessageDialog(this, "Voer telefoonnummer in", "Telefoon", JOptionPane.ERROR_MESSAGE);

        } else if (mobilePhone.equals("")) {

            jTextField_MobielNr.setBorder(BorderFactory.createMatteBorder(0, 0, 5, 0, Color.PINK));
            JOptionPane.showMessageDialog(this, "Voer mobiele telefoonnummer in", "Mobiele telefoon", JOptionPane.ERROR_MESSAGE);

        } else if (emailAddress.equals("")) {

            jTextField_Email.setBorder(BorderFactory.createMatteBorder(0, 0, 5, 0, Color.PINK));
            JOptionPane.showMessageDialog(this, "Voer e-mailadres voer in", "E-Mail addres", JOptionPane.ERROR_MESSAGE);

        } else if (!emailValidator.validate(emailAddress)) {
            jTextField_Email.setBorder(BorderFactory.createMatteBorder(0, 0, 5, 0, Color.PINK));
            JOptionPane.showMessageDialog(this, "E-mailadres is ongeldig", "E-Mail addres", JOptionPane.ERROR_MESSAGE);



        } else if (password.equals("") && nieuwLid) {
            jPasswordField1.setBorder(BorderFactory.createMatteBorder(0, 0, 5, 0, Color.PINK));
            JOptionPane.showMessageDialog(this, "Voer wachtwoord in", "E-Mail addres", JOptionPane.ERROR_MESSAGE);


        } else if (bankAccount.equals("")) {

            jTextField_Rekeningnummer.setBorder(BorderFactory.createMatteBorder(0, 0, 5, 0, Color.PINK));
            JOptionPane.showMessageDialog(this, "Voor rekeningnummer in", "Rekeningnummer", JOptionPane.ERROR_MESSAGE);

        } else {
            if (nieuwLid) {
                member.insert();
                JOptionPane.showMessageDialog(this, "Lidnummer is "+memberId, "Opgeslagen", JOptionPane.INFORMATION_MESSAGE);
            } else {
                member.update();
                JOptionPane.showMessageDialog(this, "Wijzigingen zijn opgeslagen", "Opgeslagen", JOptionPane.INFORMATION_MESSAGE);
            }
     
            // Ga terug naar het Dashboard panel 
            BarApplication.getInstance().showPanel(new MemberOverview());
            MemberOverview memberOverview = new MemberOverview();
            memberOverview.ParentCloseMe();
        }





    }//GEN-LAST:event_jButton_SaveActionPerformed

    private void jTextField_voornaamActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jTextField_voornaamActionPerformed
        // TODO add your handling code here:
    }//GEN-LAST:event_jTextField_voornaamActionPerformed

    private void jTextField_TussenvoegselActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jTextField_TussenvoegselActionPerformed
        // TODO add your handling code here:
    }//GEN-LAST:event_jTextField_TussenvoegselActionPerformed

    private void jCheckBox9_Loc2ActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jCheckBox9_Loc2ActionPerformed
        if (jCheckBox9_Loc2.isSelected()) {
            jCheckBox_Loc3.setSelected(false);
            jCheckBox_Loc1.setSelected(false);
        } else {
            jCheckBox9_Loc2.setSelected(true);
        }
    }//GEN-LAST:event_jCheckBox9_Loc2ActionPerformed

    private void jCheckBox_Loc3ActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jCheckBox_Loc3ActionPerformed
        if (jCheckBox_Loc3.isSelected()) {
            jCheckBox9_Loc2.setSelected(false);
            jCheckBox_Loc1.setSelected(false);
        } else {
            jCheckBox_Loc3.setSelected(true);
        }
    }//GEN-LAST:event_jCheckBox_Loc3ActionPerformed

    private void jCheckBox_Loc1ActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jCheckBox_Loc1ActionPerformed
        if (jCheckBox_Loc1.isSelected()) {
            jCheckBox9_Loc2.setSelected(false);
            jCheckBox_Loc3.setSelected(false);
        } else {
            jCheckBox_Loc1.setSelected(true);
        }
    }//GEN-LAST:event_jCheckBox_Loc1ActionPerformed

    private void jCheckBox5_AboVolActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jCheckBox5_AboVolActionPerformed
        if (jCheckBox5_AboVol.isSelected()) {
            jCheckBox3_AboWkDg.setSelected(false);

            //Deze code zorgt dat a.d.h.v. de geboortedata berekent wordt welk abonnement nodig is.
            ResultSet result = null;
            QueryManager queryManager = BarApplication.getQueryManager();
            birthday = jComboBox_Jaar.getSelectedItem().toString() + "-" + jComboBox_Maand.getSelectedItem().toString() + "-" + jComboBox_Dag.getSelectedItem().toString();
            SimpleDateFormat format = new SimpleDateFormat("yyyy-MM-dd");

            Date currentDate = new Date();

            Date d1 = null;
            Date d2 = null;

            try {
                d1 = format.parse(birthday);
                d2 = format.parse(format.format(currentDate));

                long diff = d2.getTime() - d1.getTime();
                // berekent of iemand jonger is dan achtien
                if ((diff / (24 * 60 * 60 * 1000)) < 6574) {
                    jCheckBoxMinderjarig.setSelected(true);
                    jCheckBoxSenioren.setSelected(false);
                    jCheckBoxVolwassen.setSelected(false);
                    result = queryManager.getAbonnement(1);
                    if (result.next()) {
                        jTextField_Bedrag.setText("\u20AC " + result.getFloat("volledigprijs"));
                    }
                    //bereken of iemand volwassen is
                } else if ((diff / (24 * 60 * 60 * 1000)) > 6573 && diff / (24 * 60 * 60 * 1000) < 23741) {
                    jCheckBoxMinderjarig.setSelected(false);
                    jCheckBoxSenioren.setSelected(false);
                    jCheckBoxVolwassen.setSelected(true);
                    result = queryManager.getAbonnement(2);
                    if (result.next()) {
                        jTextField_Bedrag.setText("\u20AC " + result.getFloat("volledigprijs"));
                    }
                    // bereken of iemand bejaard is
                } else if (diff / (24 * 60 * 60 * 1000) > 23740) {
                    jCheckBoxMinderjarig.setSelected(false);
                    jCheckBoxSenioren.setSelected(true);
                    jCheckBoxVolwassen.setSelected(false);
                    result = queryManager.getAbonnement(3);
                    if (result.next()) {
                        jTextField_Bedrag.setText("\u20AC " + result.getFloat("volledigprijs"));
                    }
                }

            } catch (Exception e) {
                e.printStackTrace();
            }

        } else {
            jCheckBoxMinderjarig.setSelected(false);
            jCheckBoxSenioren.setSelected(false);
            jCheckBoxVolwassen.setSelected(false);
            jTextField_Bedrag.setText("");
        }
    }//GEN-LAST:event_jCheckBox5_AboVolActionPerformed

    private void jCheckBox3_AboWkDgActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jCheckBox3_AboWkDgActionPerformed
        if (jCheckBox3_AboWkDg.isSelected()) {
            jCheckBox5_AboVol.setSelected(false);

            //Deze code zorgt dat a.d.h.v. de geboortedata berekent wordt welk abonnement nodig is.
            ResultSet result = null;
            QueryManager queryManager = BarApplication.getQueryManager();
            birthday = jComboBox_Jaar.getSelectedItem().toString() + "-" + jComboBox_Maand.getSelectedItem().toString() + "-" + jComboBox_Dag.getSelectedItem().toString();


            SimpleDateFormat format = new SimpleDateFormat("yyyy-MM-dd");

            Date currentDate = new Date();

            Date d1 = null;
            Date d2 = null;

            try {
                d1 = format.parse(birthday);
                d2 = format.parse(format.format(currentDate));

                long diff = d2.getTime() - d1.getTime();
                // berekent of iemand jonger is dan achtien
                if ((diff / (24 * 60 * 60 * 1000)) < 6574) {
                    jCheckBoxMinderjarig.setSelected(true);
                    jCheckBoxSenioren.setSelected(false);
                    jCheckBoxVolwassen.setSelected(false);
                    result = queryManager.getAbonnement(1);
                    if (result.next()) {
                        jTextField_Bedrag.setText("\u20AC " + result.getFloat("dalurenprijs"));
                    }
                    //bereken of iemand volwassen is
                } else if ((diff / (24 * 60 * 60 * 1000)) > 6573 && diff / (24 * 60 * 60 * 1000) < 23741) {
                    jCheckBoxMinderjarig.setSelected(false);
                    jCheckBoxSenioren.setSelected(false);
                    jCheckBoxVolwassen.setSelected(true);
                    result = queryManager.getAbonnement(2);
                    if (result.next()) {
                        jTextField_Bedrag.setText("\u20AC " + result.getFloat("dalurenprijs"));
                    }
                    // bereken of iemand bejaard is
                } else if (diff / (24 * 60 * 60 * 1000) > 23740) {
                    jCheckBoxMinderjarig.setSelected(false);
                    jCheckBoxSenioren.setSelected(true);
                    jCheckBoxVolwassen.setSelected(false);
                    result = queryManager.getAbonnement(3);
                    if (result.next()) {
                        jTextField_Bedrag.setText("\u20AC " + result.getFloat("dalurenprijs"));
                    }
                }



            } catch (Exception e) {
                e.printStackTrace();
            }

        } else {
            jCheckBoxMinderjarig.setSelected(false);
            jCheckBoxSenioren.setSelected(false);
            jCheckBoxVolwassen.setSelected(false);
            jTextField_Bedrag.setText("");
        }
    }//GEN-LAST:event_jCheckBox3_AboWkDgActionPerformed

    private void jCheckBoxMinderjarigActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jCheckBoxMinderjarigActionPerformed
        if (jCheckBoxMinderjarig.isSelected()) {
            jCheckBoxMinderjarig.setSelected(false);
        } else {
            jCheckBoxMinderjarig.setSelected(true);
        }
    }//GEN-LAST:event_jCheckBoxMinderjarigActionPerformed

    private void jCheckBoxVolwassenActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jCheckBoxVolwassenActionPerformed
        if (jCheckBoxVolwassen.isSelected()) {
            jCheckBoxVolwassen.setSelected(false);

        } else {
            jCheckBoxVolwassen.setSelected(true);
        }
    }//GEN-LAST:event_jCheckBoxVolwassenActionPerformed

    private void jCheckBoxSeniorenActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jCheckBoxSeniorenActionPerformed
        if (jCheckBoxSenioren.isSelected()) {
            jCheckBoxSenioren.setSelected(false);

        } else {
            jCheckBoxSenioren.setSelected(true);
        }
    }//GEN-LAST:event_jCheckBoxSeniorenActionPerformed

    private void jCheckBoxStatusActiefActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jCheckBoxStatusActiefActionPerformed
        if (jCheckBoxStatusActief.isSelected()){
            jCheckBoxStatusNietActief.setSelected(false);
        }
    }//GEN-LAST:event_jCheckBoxStatusActiefActionPerformed

    private void jCheckBoxStatusNietActiefActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jCheckBoxStatusNietActiefActionPerformed
        if (jCheckBoxStatusNietActief.isSelected()){
            jCheckBoxStatusActief.setSelected(false);
        }
    }//GEN-LAST:event_jCheckBoxStatusNietActiefActionPerformed
    //code voorMemberList

    private Locale getLocale(String loc) {
        if (loc != null && loc.length() > 0) {
            return new Locale(loc);
        } else {
            return Locale.US;
        }
    }
    // Variables declaration - do not modify//GEN-BEGIN:variables
    private javax.swing.JPanel Personalia_JPanel;
    private javax.swing.ButtonGroup buttonGroup1;
    private javax.swing.ButtonGroup buttonGroup2;
    private javax.swing.ButtonGroup buttonGroup3;
    private javax.swing.JButton jButton_Save;
    protected javax.swing.JCheckBox jCheckBox3_AboWkDg;
    protected javax.swing.JCheckBox jCheckBox5_AboVol;
    protected javax.swing.JCheckBox jCheckBox9_Loc2;
    private javax.swing.JCheckBox jCheckBoxMinderjarig;
    private javax.swing.JCheckBox jCheckBoxSenioren;
    protected javax.swing.JCheckBox jCheckBoxStatusActief;
    protected javax.swing.JCheckBox jCheckBoxStatusNietActief;
    private javax.swing.JCheckBox jCheckBoxVolwassen;
    protected javax.swing.JCheckBox jCheckBox_Loc1;
    protected javax.swing.JCheckBox jCheckBox_Loc3;
    protected javax.swing.JCheckBox jCheckBox_Man;
    protected javax.swing.JCheckBox jCheckBox_Vrouw;
    protected javax.swing.JComboBox jComboBox_Dag;
    protected javax.swing.JComboBox jComboBox_Jaar;
    protected javax.swing.JComboBox jComboBox_Maand;
    private javax.swing.JLabel jLabel1;
    private javax.swing.JLabel jLabel10;
    private javax.swing.JLabel jLabel11;
    private javax.swing.JLabel jLabel12;
    private javax.swing.JLabel jLabel13;
    private javax.swing.JLabel jLabel14;
    private javax.swing.JLabel jLabel15;
    private javax.swing.JLabel jLabel16;
    private javax.swing.JLabel jLabel17;
    private javax.swing.JLabel jLabel18;
    private javax.swing.JLabel jLabel19;
    private javax.swing.JLabel jLabel2;
    private javax.swing.JLabel jLabel20;
    private javax.swing.JLabel jLabel21;
    private javax.swing.JLabel jLabel23;
    private javax.swing.JLabel jLabel26;
    private javax.swing.JLabel jLabel3;
    private javax.swing.JLabel jLabel4;
    private javax.swing.JLabel jLabel5;
    private javax.swing.JLabel jLabel6;
    private javax.swing.JLabel jLabel7;
    private javax.swing.JLabel jLabel8;
    private javax.swing.JLabel jLabel9;
    private javax.swing.JPanel jPanel1;
    private javax.swing.JPanel jPanel3;
    private javax.swing.JPanel jPanel4;
    private javax.swing.JPanel jPanel5;
    private javax.swing.JPanel jPanel6;
    private javax.swing.JPasswordField jPasswordField1;
    protected javax.swing.JTextField jTextField_Achternaam;
    private javax.swing.JTextField jTextField_Bedrag;
    protected javax.swing.JTextField jTextField_Email;
    protected javax.swing.JTextField jTextField_MemberId;
    protected javax.swing.JTextField jTextField_MobielNr;
    protected javax.swing.JTextField jTextField_Postcode;
    protected javax.swing.JTextField jTextField_Rekeningnummer;
    protected javax.swing.JTextField jTextField_StraatHnr;
    protected javax.swing.JTextField jTextField_Telnr;
    protected javax.swing.JTextField jTextField_Tussenvoegsel;
    protected javax.swing.JTextField jTextField_voornaam;
    protected javax.swing.JTextField jTextField_woonplaats;
    private javax.swing.JToggleButton jToggleButton1;
    // End of variables declaration//GEN-END:variables
}
